Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that alias-relate terms are WF if reporting an error in alias-relate #126404

Merged
merged 2 commits into from
Jun 15, 2024

Conversation

compiler-errors
Copy link
Member

Check that each of the left/right term is WF when deriving a best error obligation for an alias-relate goal. This will make sure that given <i32 as NotImplemented>::Assoc = () will drill down into i32: NotImplemented since we currently treat the projection as rigid.

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 13, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2024

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

if let Some(ty::PredicateKind::AliasRelate(lhs, rhs, _)) = pred_kind.no_bound_vars() {
if let Some(obligation) = goal
.infcx()
.visit_proof_tree(
Copy link
Member Author

@compiler-errors compiler-errors Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is jank and incorrect -- we're not inheriting a depth, so we can potentially stack overflow here.

Any ideas on a first-class way to create a custom nested obligation even though we don't have one in the proof tree? Should I just expose a constructor on InspectGoal?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, alternatively visit_proof_tree_at_depth or sth? Not sure, I don't 100% like the current proof tree API

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that for now. It shouldn't be difficult to change.

@lcnr
Copy link
Contributor

lcnr commented Jun 15, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 15, 2024

📌 Commit 0562064 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2024
…llaumeGomez

Rollup of 9 pull requests

Successful merges:

 - rust-lang#126229 (Bump windows-bindgen to 0.57)
 - rust-lang#126404 (Check that alias-relate terms are WF if reporting an error in alias-relate)
 - rust-lang#126410 (smir: merge identical Constant and ConstOperand types)
 - rust-lang#126478 (Migrate `run-make/codegen-options-parsing` to `rmake.rs`)
 - rust-lang#126496 (Make proof tree probing and `Candidate`/`CandidateSource` generic over interner)
 - rust-lang#126508 (Make uninitialized_error_reported a set of locals)
 - rust-lang#126517 (Migrate `run-make/dep-graph` to `rmake.rs`)
 - rust-lang#126525 (trait_selection: remove extra words)
 - rust-lang#126526 (tests/ui/lint: Move 19 tests to new `non-snake-case` subdir)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 709d862 into rust-lang:master Jun 15, 2024
6 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2024
Rollup merge of rust-lang#126404 - compiler-errors:alias-relate-terms, r=lcnr

Check that alias-relate terms are WF if reporting an error in alias-relate

Check that each of the left/right term is WF when deriving a best error obligation for an alias-relate goal. This will make sure that given `<i32 as NotImplemented>::Assoc = ()` will drill down into `i32: NotImplemented` since we currently treat the projection as rigid.

r? lcnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants